/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package actions;

import actionForms.registroActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;

/**
 *
 * @author Administrador
 */
public class controladorAction extends org.apache.struts.action.Action {
    
    /* forward name="success" path="" */
    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param form The optional ActionForm bean for this request.
     * @param request The HTTP Request we are processing.
     * @param response The HTTP Response we are processing.
     * @throws java.lang.Exception
     * @return
     */
    public ActionForward execute(ActionMapping mapping, ActionForm  form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        registroActionForm form1 = (registroActionForm)form;
        String accion = form1.getAccion()!=null?form1.getAccion():"";
        String destino="";
        if(accion.equalsIgnoreCase("")){  
            destino="paginaRegistro";
            //ingreso inicial cuando esta todo vacio
        }else if(accion.equalsIgnoreCase("registrado")){
            form1.setEdad(2008-form1.getEdad());
            destino="mostrarDatos";
            //obtenedor de edad y fw a mostrar los datos
        }
   
        
        
        return mapping.findForward(destino);
        
    }
}